#ifndef __DEVICE_H__
#define __DEVICE_H__

enum
{
    IOCTL_GET_DEVICE_GEOMETRY = 1,
    IOCTL_REREAD_PTABLE,
    IOCTL_GET_DEVICE_PATH,
    IOCTL_GET_NODEID,
    IOCTL_USER = 100000000
};



typedef struct device_geometry
{
	uint32	start_sector;
	off_t 	sector_count;			//may int64 in the feature
	off_t 	cylinder_count;			//may int64 in the feature
	off_t 	sectors_per_track;
	uint32 	head_count;
	uint32 	bytes_per_sector;
	bool	read_only;
	bool	removable;
} device_geometry;


struct partition_info
{
	off_t	start;					/* start lba */
	off_t	offset;					/* offset (in bytes) */
	off_t	size;					/* size (in bytes) */
	int32	type;					
	int32	status;		
	int32	block_size;				/* block size of partition */
	int32	session;				/* id of session */
	int32	partition;				/* id of partition */
	char	device[256];			/* path to the physical device */
};



typedef size_t disk_read_op( void* pnode, off_t nOffset, void* pBuffer, size_t nSize );

typedef int dop_open( void* pnode, uint32 nFlags, void **pcookie );
typedef int dop_free_cookie(void *cookie);
typedef int dop_close( void* pnode, void* pcookie );
typedef int dop_ioctl( void* pnode, void* pcookie, uint32 command, void* pArgs);
typedef int dop_read( void* pnode, void* pcookie, off_t nPosition, void* pBuffer, size_t nSize );
typedef int dop_write( void* pnode, void* pcookie, off_t nPosition, const void* pBuffer, size_t nSize );


struct	device_opertions
{
    dop_open*			open;
    dop_close*			close;
	dop_free_cookie*	free_cookie;
    dop_ioctl*			ioctl;
    dop_read*			read;
    dop_write*			write;
};


#endif// __DEVICE_H__


